import { request } from "@/utils/request";
import type { PaginationType } from "@/types";
import type {
  PlaylistResult,
  PlayListDynamic,
  PlayListSongsResult,
} from "@/types/playList/detail";
import type { HttpResponse } from "@/types/request";
import { PlayListCommentResult } from "@/types/comment";

// 歌单分类
export const getPlayListCatList = () =>
  request({
    url: "/playlist/catlist",
    method: "GET",
  });

// 精品歌单标签列表
export const getPlayListTagList = () =>
  request({
    url: "/playlist/highquality/tags",
    method: "GET",
  });

// 获取精品歌单
export const getHighqualityPlayList = () =>
  request({
    url: "/top/playlist/highquality",
    method: "GET",
  });

// 歌单详情动态
export const getPlayListDynamic = (id: number): Promise<PlayListDynamic> =>
  request<PlayListDynamic>({
    url: "/playlist/detail/dynamic",
    method: "GET",
    data: { id },
  });

// 获取歌单详情
export const getPlayListDetail = (id: number): Promise<PlaylistResult> =>
  request<PlaylistResult>({
    url: "/playlist/detail",
    method: "GET",
    data: { id },
  });

// 获取歌单所有歌曲
export const getPlayListAllSongs = (
  data: { id: number } & PaginationType
): Promise<PlayListSongsResult> =>
  request<PlayListSongsResult>({
    url: "/playlist/track/all",
    method: "GET",
    data,
  });

// 歌单评论
export const getPlayListComment = (
  data: { id: number } & PaginationType
): Promise<PlayListCommentResult> =>
  request<PlayListCommentResult>({
    url: "/comment/playlist",
    method: "GET",
    data,
  });

// 楼层评论
export const getPlayListFloorComment = () =>
  request({
    url: "/comment/floor",
    method: "GET",
    // data,
  });

// 喜欢音乐列表
export const getLikeList = (
  uid: number
): Promise<HttpResponse & { ids: number[] }> =>
  request({
    url: "/likelist",
    method: "GET",
    data: { uid },
  });
